const http = require("./http");
class AllHttp extends http{
  static cartHttp(){
    return this.request("http://124.70.134.133:3000/cart")
  }
  static cityHttp(){
    return this.request("http://47.108.197.28:8000/city")  
   
}
  static async show(value){
    var data = []
    var Res = await (this.cityHttp());
    console.log(Res.data.data.cities);
    var cities = Res.data.data.cities;
    for(var k in cities){
      if(k==value){
        data=cities[k]
        // break
      }else{
        cities[k].forEach(item=>{
          if(item.spell.includes(value)||item.name.includes(value)){
            data.push(item)
          }
        })
      }
    }
    return data
  }
}
module.exports = AllHttp;